package com.lh.item.api;

import com.lh.common.pojo.PageResult;
import com.lh.item.pojo.BrandDo;
import com.lh.item.pojo.SpuDo;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品相关api，用于开放给外部module使用
 *
 * @author liuhe
 * @date 2020/06/24
 */
@RequestMapping("brand")
public interface BrandApi {

    /**
     * 搜索品牌
     */
    @GetMapping("page")
    PageResult<BrandDo> queryBrandList(@RequestParam(value = "key", required = false) String key,
                                       @RequestParam(value = "page", defaultValue = "0") Integer page,
                                       @RequestParam(value = "rows", defaultValue = "10") Integer rows,
                                       @RequestParam(value = "sortBy", required = false) String sortBy,
                                       @RequestParam(value = "desc", required = false) Boolean desc);

    /**
     * 根据商品分类查询品牌列表
     */
    @GetMapping("cid/{cid}")
    List<BrandDo> queryBrandByCid(@PathVariable(value = "cid", required = true) Long cid);


    @GetMapping("list")
    List<BrandDo> queryBrandByIds(@RequestParam("ids") List<Long> ids);

    /**
     * 保存品牌信息
     * 加上@RequestBody会报415
     */
    @PostMapping
    Boolean saveBrand(/*@RequestBody*/ BrandDo brandDo, @RequestParam("cids") List<Long> cids);
}
